<?php
/*------------------------------------------------------------------------
# company - quota management 
# @author    pipapai.com by mawei
-------------------------------------------------------------------------*/
defined('_JEXEC') or die;
// disable core styles to avoid bs conflict 
OC_Util::$core_styles = array();

if(isDevMode()) {
   OCP\Util::addStyle('company', 'quota');
   OCP\Util::addScript('company', 'quota');
} else {
   OCP\Util::addStyle('static', 'company');
   OCP\Util::addScript('static', 'apps/company.quota.min');
}


OCP\App::setActiveNavigationEntry('company_settings');

$lang = PFactory::getLanguage();
$lang->load("com_jobs", JPATH_SITE, "zh-CN");

$freeQuota = $_['defaultQuotas']['free'];
$basicQuota = $_['defaultQuotas']['basic'];
$enterpriseQuota = $_['defaultQuotas']['enterprise'];
$superQuota = $_['defaultQuotas']['super'];
$userQuota = PCompanyHelper::getUserQuota();
$smsFreeEvent = PCompanyHelper::getQuotaEvent('sms_free');
?>

<script type="text/javascript" src="<?php print_unescaped(OC_Helper::linkTo('company/js', 'company.php'));?>"></script>

<div class="hr_inner_navigate clearfix">
	<ul class="clearfix">
      <?php PCompanyHelper::showNavigationMenu($_['masteruser'], 'quota');?>
   </ul>
</div>

<div class="hr_valueaddbox">
   <div class="oldmenu">
   	<a href="javascript:;" class="ppp_whitebtn" id="showOrderList">历史订单(<span class="orderCount"><?=$userQuota['order_count']?></span>)</a>
      <span>点击此处可管理订单（上传汇款凭证或取消订单）</span>
   </div>
   
   <?php if (!empty($smsFreeEvent->content)): ?>
   <div class="quotayellowtiptxt">
      <?=$smsFreeEvent->content?>
   </div>
   <?php endif; ?>
   
   <?php if (PCompanyHelper::checkQuotaEnable()): ?>
   <div id="accountLevel" class="valueaddtablebox">
   	<table width="100%" cellpadding="0" cellspacing="0" border="0">
      	<tr>
         	<th width="27%" align="left">服务名称</th>
            <th width="18%">免费用户</th>
            <th width="18%">基本用户</th>
            <th width="18%">企业用户</th>
            <th width="19%">超级用户</th>
         </tr>
         <tr class="moreheight">
            <td>账户级别</td>
            <td align="center"><?=($userQuota['qtype'] == 'free' ? '使用中' : '--')?></td>
            <td align="center"><?=($userQuota['qtype'] == 'basic' ? '到期时间：'.(!isNullDate($userQuota['expired']) ? $userQuota['expired'].' &nbsp;&nbsp;&nbsp; <a class="upgrade" data-upgrade_type="basic" data-type_name="基本用户" href="javascript:;">续费</a>' : '永久有效') : ($userQuota['type_id'] > $basicQuota['type_id'] ? '--' : '<a href="javascript:;" class="ppp_bluebtn purcharbtn upgrade" data-upgrade_type="basic" data-type_name="基本用户">立即购买</a>'))?></td>
            <td align="center"><?=($userQuota['qtype'] == 'enterprise' ? '到期时间：'.(!isNullDate($userQuota['expired']) ? $userQuota['expired'].' &nbsp;&nbsp;&nbsp; <a class="upgrade" data-upgrade_type="enterprise" data-type_name="企业用户" href="javascript:;">续费</a>' : '永久有效')  : ($userQuota['type_id'] > $enterpriseQuota['type_id'] ? '--' : '<a href="javascript:;" class="ppp_bluebtn purcharbtn upgrade" data-upgrade_type="enterprise" data-type_name="企业用户">立即购买</a>'))?></td>
            <td align="center"><?=($userQuota['qtype'] == 'super' ? '到期时间：'.(!isNullDate($userQuota['expired']) ? $userQuota['expired'].' &nbsp;&nbsp;&nbsp; <a class="upgrade" data-upgrade_type="super" data-type_name="超级用户" href="javascript:;">续费</a>' : '永久有效'): ($userQuota['type_id'] > $superQuota['type_id'] ? '--' : '<a href="javascript:;" class="ppp_bluebtn purcharbtn upgrade" data-upgrade_type="super" data-type_name="超级用户">立即购买</a>'))?></td>
         </tr>
      </table>
   </div>
   
   <div class="valueaddtablebox">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
      	 <tr>
         	<th width="100%"><a href="javascript:;" id="checkAccountDetails" class="checkaccount open">查看账户级别明细<i class="icon_down icon_up"></i></a></th>
         </tr>
      </table>
   </div>
   
   <div id="accountDetails" class="valueaddtablebox">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
         <tr class="tdnobordertop">
            <td width="10%" align="center" rowspan="4">简历管理</td>
         	<td width="17%">简历管理，搜索，收藏，标签</td>
            <td width="18%" align="center"><i class="gougouicon"></i></td>
            <td width="18%" align="center"><i class="gougouicon"></i></td>
            <td width="18%" align="center"><i class="gougouicon"></i></td>
            <td width="19%" align="center"><i class="gougouicon"></i></td>
         </tr>
         <tr>
         	<td width="17%">邮件群发</td>
            <td width="18%" align="center"><i class="gougouicon"></i></td>
            <td width="18%" align="center"><i class="gougouicon"></i></td>
            <td width="18%" align="center"><i class="gougouicon"></i></td>
            <td width="19%" align="center"><i class="gougouicon"></i></td>
         </tr>
         <tr>
         	<td width="17%">短信群发</td>
            <td width="18%" align="center">需短信包</td>
            <td width="18%" align="center">需短信包</td>
            <td width="18%" align="center">需短信包</td>
            <td width="19%" align="center">需短信包</td>
         </tr>
         <tr>
         	<td width="17%">简历库容量</td>
            <td width="18%" align="center"><?=isset($freeQuota['resume_max']) ? ($freeQuota['resume_max']=='any' ? '不限' : $freeQuota['resume_max']) : 1000?></td>
            <td width="18%" align="center"><?=isset($basicQuota['resume_max']) ? ($basicQuota['resume_max']=='any' ? '不限' : $basicQuota['resume_max']) : 10000?></td>
            <td width="18%" align="center"><?=isset($enterpriseQuota['resume_max']) ? ($enterpriseQuota['resume_max']=='any' ? '不限' : $enterpriseQuota['resume_max']) : 50000?></td>
            <td width="19%" align="center"><?=isset($superQuota['resume_max']) ? ($superQuota['resume_max']=='any' ? '不限' : $superQuota['resume_max']) : '不限'?></td>
         </tr>
      </table>
      
      <table width="100%" cellpadding="0" cellspacing="0" border="0" class="trhavebgcolor">   
         <tr class="tdnobordertop">
            <td width="10%" align="center" rowspan="3">评测管理</td>
         	<td width="17%">在线笔试及性格评测</td>
            <td width="18%" align="center"><i class="gougouicon"></i></td>
            <td width="18%" align="center"><i class="gougouicon"></i></td>
            <td width="18%" align="center"><i class="gougouicon"></i></td>
            <td width="19%" align="center"><i class="gougouicon"></i></td>
         </tr>
         <tr>
         	<td width="17%">邮件邀请(自动、手动)</td>
            <td width="18%" align="center"><i class="gougouicon"></i></td>
            <td width="18%" align="center"><i class="gougouicon"></i></td>
            <td width="18%" align="center"><i class="gougouicon"></i></td>
            <td width="19%" align="center"><i class="gougouicon"></i></td>
         </tr>
         <tr>
         	<td width="17%">短信邀请(自动、手动)</td>
            <td width="18%" align="center">需短信包</td>
            <td width="18%" align="center">需短信包</td>
            <td width="18%" align="center">需短信包</td>
            <td width="19%" align="center">需短信包</td>
         </tr>
      </table>
      
      <table width="100%" cellpadding="0" cellspacing="0" border="0">   
         <tr class="tdnobordertop">
            <td width="10%" align="center" rowspan="3">面试管理</td>
         	<td width="17%">日程管理，反馈，Offer</td>
            <td width="18%" align="center"><i class="gougouicon"></i></td>
            <td width="18%" align="center"><i class="gougouicon"></i></td>
            <td width="18%" align="center"><i class="gougouicon"></i></td>
            <td width="19%" align="center"><i class="gougouicon"></i></td>
         </tr>
         <tr>
         	<td width="17%">邮件提醒</td>
            <td width="18%" align="center"><i class="gougouicon"></i></td>
            <td width="18%" align="center"><i class="gougouicon"></i></td>
            <td width="18%" align="center"><i class="gougouicon"></i></td>
            <td width="19%" align="center"><i class="gougouicon"></i></td>
         </tr>
         <tr>
         	<td width="17%">短信提醒</td>
            <td width="18%" align="center">需短信包</td>
            <td width="18%" align="center">需短信包</td>
            <td width="18%" align="center">需短信包</td>
            <td width="19%" align="center">需短信包</td>
         </tr>
      </table>
      
      <table width="100%" cellpadding="0" cellspacing="0" border="0" class="trhavebgcolor">   
         <tr class="tdnobordertop">
            <td width="10%" align="center" rowspan="2">招聘渠道</td>
         	<td width="17%">招聘网站集成</td>
            <td width="18%" align="center"><i class="gougouicon"></i></td>
            <td width="18%" align="center"><i class="gougouicon"></i></td>
            <td width="18%" align="center"><i class="gougouicon"></i></td>
            <td width="19%" align="center"><i class="gougouicon"></i></td>
         </tr>
         <tr>
         	<td width="17%">发布职位</td>
            <td width="18%" align="center"><i class="gougouicon"></i></td>
            <td width="18%" align="center"><i class="gougouicon"></i></td>
            <td width="18%" align="center"><i class="gougouicon"></i></td>
            <td width="19%" align="center"><i class="gougouicon"></i></td>
         </tr>
      </table>
      
      <table width="100%" cellpadding="0" cellspacing="0" border="0">   
         <tr class="tdnobordertop">
            <td width="10%" align="center">子账号</td>
         	<td width="17%">子账号个数</td>
            <td width="18%" align="center"><?=isset($freeQuota['subaccount_max']) ? ($freeQuota['subaccount_max']=='any' ? '不限' : $freeQuota['subaccount_max']) : 1?></td>
            <td width="18%" align="center"><?=isset($basicQuota['subaccount_max']) ? ($basicQuota['subaccount_max']=='any' ? '不限' : $basicQuota['subaccount_max']) : 1?></td>
            <td width="18%" align="center"><?=isset($enterpriseQuota['subaccount_max']) ? ($enterpriseQuota['subaccount_max']=='any' ? '不限' : $enterpriseQuota['subaccount_max']) : 1?></td>
            <td width="19%" align="center"><?=isset($superQuota['subaccount_max']) ? ($superQuota['subaccount_max']=='any' ? '不限' : $superQuota['subaccount_max']) : 1?></td>
         </tr>
      </table>
      
      <table width="100%" cellpadding="0" cellspacing="0" border="0" class="trhavebgcolor">   
         <tr class="tdnobordertop">
            <td width="10%" align="center">客服</td>
         	<td width="17%">客服类型</td>
            <td width="18%" align="center">Email及在线客服</td>
            <td width="18%" align="center">Email、在线客服及电话支持</td>
            <td width="18%" align="center">Email、在线客服及电话支持</td>
            <td width="19%" align="center">Email、在线客服及电话支持</td>
         </tr>
      </table>
   </div>
   <?php endif; ?>
   
   <div class="valueaddtablebox" style="margin-top:10px;">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
      	 <tr>
         	<th width="27%" align="left">服务名称</th>
            <th width="18%">已购数量</th>
            <th width="18%">剩余</th>
            <th width="18%">单价</th>
            <th width="19%">购买数量</th>
         </tr>
         <tr id="smsInfo" class="nolrborder">
            <td>短信包 <span class="pull-right"><a target="_blank" href="<?=OC_Helper::linkToRoute('company_emailsms')?>" id="smsSettingsBtn">发送设置</a> <em class="line">|</em> <a href="javascript:;" id="smsHistoryBtn">发送记录</a></span></td>
            <td align="center"><?=$userQuota['sms_num']?> 条</td>
            <td align="center"><span class="yellowcolor"><?=$userQuota['sms_left']?> 条</span></td>
            <td align="center"><?=($userQuota['sms_unit_price'] == 0 ? '免费' : '100元/' . 100/$userQuota['sms_unit_price'])?>（条）</td>
            <td align="center">
               <select id="smsBuyNum"><option>1000</option><option>2000</option><option>3000</option></select>
               条
               <a href="javascript:;" id="smsBuy" class="ppp_bluebtn purcharbtn" data-sms_unit_price="<?=$userQuota['sms_unit_price']?>">立即购买</a>
            </td>
         </tr>
      </table>
   </div>
   
   <div class="valueaddtablebox" style="margin-top:10px;">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
      	 <tr class="normalweight quotasms_tr">
         	<th width="10%">咨询购买</th>
            <th width="40%" align="left"><span><em>公司全称</em> <?=PIPAPAI_COMPANY_NAME?><br/><em>客服电话</em> <?=PIPAPAI_SUPPORT_PHONE?><br/><em>客服Email</em> <?=PIPAPAI_SUPPORT_EMAIL?></span></th>
            <th width="10%">汇款账号</th>
            <th width="40%" align="left"><span><em>公司全称</em> <?=PIPAPAI_COMPANY_NAME?><br/><em>开户行</em> <?=PIPAPAI_BANK?><br/><em>银行帐户</em> <?=PIPAPAI_BANK_ACCOUNT?></span></th>
         </tr>
      </table>
   </div>
</div>

<!-- 历史记录的dialog -->
<div id="orderList" class="modal hide fade valuemodal oldordermenu_dialog" id="oldordermenu_dialog" style="position:absolute;">
   <div class="modal-header">
      <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
      <h3></h3>
   </div>
   <div id="orderListBody" class="modal-body"></div>
   <div id="uploadReceiptDiv" class="upload_valueadd popup" style="display:none;">
      <i></i>
      <div class="closediv"></div>
      <div id="uploadReceiptForm" class="upd_valdcontent">
         <form id="uploadform" action="<?php echo OC_Helper::linkToRoute('company_uploadreceipt');?>" method="POST" enctype="multipart/form-data">
            <div class="uploadfilebtnbox">
               <span class="large" data-nodragtext="选择文件上传">选择或拖拽文件上传</span>
               <input type="file" name="Filedata"/>
               <input type="hidden" id="uploadOrderId" name="order_id" value=""/>
               <input type="hidden" name="requesttoken" value="<?php echo $_['requesttoken'] ?>" id="uploadToken">
            </div>
         </form>
         <span class="medium" style="color:#999">(支持最大4Ｍ的JPG,PNG格式的图像文件上传)</span>
         <table id="receiptPicTable" width="226" cellpadding="0" cellspacing="0" border="0" style="margin:auto; margin-top:5px;display:none;">
            <tr>
               <td id="receiptPicTd" height="25"></td>
            </tr>
         </table>
         <table id="uploadTable" class="files" width="226" cellpadding="0" cellspacing="0" border="0" style="margin:auto;">
            <tr class="file_upload_template" style="display:none;">
               <td class="file_name"></td>
               <!-- <td class="file_size"></td> -->
               <td class="file_upload_progress"><div style="width:80px;"></div></td>
            </tr>
         </table>
         <div id="receipt_upload_error" class="error" style="padding-left:26px;font-size: 12px;"></div>
      </div>
   </div>
</div>

<!-- 购买订单的dialog -->
<div class="modal hide fade valuemodal ordermenudetail_dialog" id="orderDetail" style="position:absolute;">
   <div class="modal-header">
      <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
      <h3></h3>
   </div>
   <div id="orderDetailBody" class="modal-body"></div>
</div>

<!-- 发送消息的记录的dialog -->
<div class="modal hide fade valuemodal oldordermenu_dialog sendrecord_dialog" id="smsHistory" style="position:absolute;">
	<div class="modal-header">
      <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
      <h3></h3>
   </div>
   <div id="smsHistoryBody" class="modal-body"></div>
</div>

<input type="hidden" name="requesttoken" value="<?php echo $_['requesttoken'] ?>" id="requesttoken">

